
R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Warning messages:
1: package ‘ggplot2’ was built under R version 4.3.1 
2: package ‘dplyr’ was built under R version 4.3.1 
3: package ‘stringr’ was built under R version 4.3.1 
> library(ccesMRPprep)
> library(ccesMRPrun)
> library(brms)
Loading required package: Rcpp
Loading 'brms' package (version 2.17.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').

Attaching package: ‘brms’

The following object is masked from ‘package:stats’:

    ar

> library(tictoc)
> library(furrr)
Loading required package: future
Warning message:
package ‘future’ was built under R version 4.3.1 
> # Survey data and covariates ------
> runs <- c("full", "nocontradict")
> for (x in runs) {
+     if (x == "full") {
+         file1 <- "data/output/ccc_2016-2020_voted_2pty.rds"
+         file2 <- "data/output/by-cd_pct-race_elec.csv"
+         file3 <- "data/output/brm16_fit.rds"
+         file4 <- "data/output/brm20_fit.rds"
+     } else if (x == "nocontradict") {
+         file1 <- "data/output/ccc_2016-2020_voted_2pty_noc.rds"
+         file2 <- "data/output/by-cd_pct-race_elec_noc.csv"
+         file3 <- "data/output/brm16_fit_noc.rds"
+         file4 <- "data/output/brm20_fit_noc.rds"
+     }
+ svy <- read_rds(file1)
+ cd_elec <- read_csv("data/input/cd_presvote_2016-2020.csv") |>
+   dplyr::select(year, cd, pct_trump)
+ cd_race <- read_csv(file2)
+ 
+ svy_elec <- svy |>
+   mutate(
+     race_Black    = as.integer(race == "Black"),
+     race_Hispanic = as.integer(race == "Hispanic"),
+     race_Other    = as.integer(race == "Other"),
+   ) |>
+   inner_join(cd_elec, by = c("year", "cd")) |>
+   inner_join(cd_race, by = c("year", "cd")) |>
+   left_join(dplyr::select(ccesMRPprep::states_key, st, region, division), by = "st")
+ 
+ stopifnot(nrow(svy_elec) == nrow(svy) - sum(svy$cd == "DC-01"))
+ 
+ svy16_elec <- filter(svy_elec, year == 2016)
+ svy20_elec <- filter(svy_elec, year == 2020)
+ 
+ 
+ # Fit ----
+ Form <- trump  ~ (1 + race * educ + female + age | division / st / cd) +
+   race + pct_white_elec +
+   race_Black:pct_black_elec + race_Hispanic:pct_hispanic_elec + race_Other:pct_raceother_elec +
+   s(pct_trump, k = 3)
+ 
+ # direct ----
+ fit_dir_race <- direct_ests(Form, svy_elec, area_var = c("year", "cd", "race"), weight_var = "weight") |>
+     complete(year, cd, race) |>
+     mutate(n_raw = replace_na(n_raw, 0),
+            n_wt = replace_na(n_wt, 0))
+ 
+ fit_dir_race |> write_rds("data/output/dir_fit_race.rds")
+ # Fit Trump hieararchical vote model -----
+ # 132 min with varying slopes, cmdstanr 2e3 iter on M1 chip; 180 min with cd_nonwhite interaction
+ plan(multisession, workers = 4)
+ tic()
+ fit16_brm <- fit_brms(Form, .data = svy16_elec, .backend = "rstan", .iter = 2e3, .threads = 1)
+ toc()
+ fit16_brm |> write_rds(file3)
+ gc()
+ 
+ # 125 mins with cmdstanr on M1 chip; 230 min with cd_nonwhite interaction
+ tic()
+ fit20_brm <- fit_brms(Form, verbose= FALSE, .data = svy20_elec, .backend = "rstan", .iter = 2e3, .threads = 1)
+ toc()
+ fit20_brm |> write_rds(file4)
+ }
Rows: 870 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): cd, dailykos_name, largest_place
dbl (6): year, pct_trump, pct_romney, pct_mccain, pct_trump16, totalvoters

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 870 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): cd
dbl (6): year, pct_white_elec, pct_nonwhite_elec, pct_black_elec, pct_hispan...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Compiling Stan program...
Start sampling

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 
SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 4).
1).

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 2).

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 3).
Chain 2: 
Chain 2: Gradient evaluation took 0.036915 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 369.15 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 1: 
Chain 1: Gradient evaluation took 0.049229 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 492.29 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 3: 
Chain 3: Gradient evaluation took 0.102972 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 1029.72 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 4: 
Chain 4: Gradient evaluation took 0.110226 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 1102.26 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Exception: model2dee2867657d__namespace::write_array: Cor_3 is not positive definite. (in 'anon_model', line 349, column 2 to column 66)
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 1: Exception: model2dee2867657d__namespace::write_array: Cor_3 is not positive definite. (in 'anon_model', line 349, column 2 to column 66)
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 1: Exception: model2dee2867657d__namespace::write_array: Cor_3 is not positive definite. (in 'anon_model', line 349, column 2 to column 66)
Chain 1: Exception: model2dee2867657d__namespace::write_array: Cor_3 is not positive definite. (in 'anon_model', line 349, column 2 to column 66)
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 4: Exception: model2dee2867657d__namespace::write_array: Cor_1 is not positive definite. (in 'anon_model', line 343, column 2 to column 66)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 6365.97 seconds (Warm-up)
Chain 3:                3394.01 seconds (Sampling)
Chain 3:                9759.98 seconds (Total)
Chain 3: 
 [1] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                        
 [2] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"
 [3] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                
 [4] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                              
 [5] "Chain 3: "                                                                                                                                                                                                                                      
 [6] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                        
 [7] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"
 [8] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                
 [9] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                              
[10] "Chain 3: "                                                                                                                                                                                                                                      
[11] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                        
[12] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"
[13] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                
[14] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                              
[15] "Chain 3: "                                                                                                                                                                                                                                      
[16] "Error : Exception: model2dee2867657d__namespace::write_array: Cor_2 is not positive definite. (in 'anon_model', line 346, column 2 to column 66)"                                                                                               
error occurred during calling the sampler; sampling not done
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 6383.55 seconds (Warm-up)
Chain 1:                3399.97 seconds (Sampling)
Chain 1:                9783.51 seconds (Total)
Chain 1: 
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 6735.2 seconds (Warm-up)
Chain 2:                3222.88 seconds (Sampling)
Chain 2:                9958.08 seconds (Total)
Chain 2: 
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 6880 seconds (Warm-up)
Chain 4:                3123.61 seconds (Sampling)
Chain 4:                10003.6 seconds (Total)
Chain 4: 
here are whatever error messages were returned
[[1]]
Stan model 'anon_model' does not contain samples.

10141.159 sec elapsed
Compiling Stan program...
Start sampling
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
 [1] "Error : Exception: model2dee16e33102__namespace::write_array: Cor_2 is not positive definite. (in 'anon_model', line 346, column 2 to column 66)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 [2] "In addition: Warning messages:"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
 [3] "1: In .local(object, ...) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
 [4] "  some chains had errors; consider specifying chains = 1 to debug"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
 [5] "2: In validityMethod(object) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
 [6] "  The following variables have undefined values:  b_Intercept,The following variables have undefined values:  cor_1[1],The following variables have undefined values:  cor_1[2],The following variables have undefined values:  cor_1[3],The following variables have undefined values:  cor_1[4],The following variables have undefined values:  cor_1[5],The following variables have undefined values:  cor_1[6],The following variables have undefined values:  cor_1[7],The following variables have undefined values:  cor_1[8],The following variables have undefined values:  cor_1[9],The following variables have undefined values:  cor_1[10],The following variables have undefined values:  cor_1[11],The following variables have undefined values:  cor_1[12],The following variables have undefined values:  cor_1[13],The following variables have undefined values:  cor_1[14],The following variables have undefined values:  cor_1[15],The following variables have undefined values:  cor_1[16],The following variabl [... truncated]"
 [7] "3: There were 1 divergent transitions after warmup. See"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 [8] "https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
 [9] "to find out why this is a problem and how to eliminate them. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
[10] "4: Examine the pairs() plot to diagnose sampling problems"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[11] " "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
error occurred during calling the sampler; sampling not done
here are whatever error messages were returned
[[1]]
Stan model 'anon_model' does not contain samples.

13764.45 sec elapsed
Rows: 870 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): cd, dailykos_name, largest_place
dbl (6): year, pct_trump, pct_romney, pct_mccain, pct_trump16, totalvoters

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 870 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): cd
dbl (6): year, pct_white_elec, pct_nonwhite_elec, pct_black_elec, pct_hispan...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Compiling Stan program...
Start sampling

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 1).

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 2).

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 4).

SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 3).
Chain 2: 
Chain 2: Gradient evaluation took 0.045554 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 455.54 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 4: 
Chain 4: Gradient evaluation took 0.064171 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 641.71 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 1: 
Chain 1: Gradient evaluation took 0.0824 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 824 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 3: 
Chain 3: Gradient evaluation took 0.08497 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 849.7 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
Chain 4: Exception: model2dee73e75235__namespace::write_array: Cor_1 is not positive definite. (in 'anon_model', line 343, column 2 to column 66)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 5343.17 seconds (Warm-up)
Chain 1:                3355.5 seconds (Sampling)
Chain 1:                8698.67 seconds (Total)
Chain 1: 
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 5550.08 seconds (Warm-up)
Chain 3:                3299.96 seconds (Sampling)
Chain 3:                8850.04 seconds (Total)
Chain 3: 
 [1] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 [2] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 [3] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 [4] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
 [5] "Chain 3: "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
 [6] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 [7] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 [8] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 [9] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[10] "Chain 3: "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[11] "Chain 3: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
[12] "Chain 3: Exception: Exception: binomial_logit_lpmf: Probability parameter[1] is nan, but must be finite! (in 'anon_model', line 40, column 4 to column 73) (in 'anon_model', line 330, column 4 to column 1084) [origin: unknown original type]"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
[13] "Chain 3: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
[14] "Chain 3: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[15] "Chain 3: "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[16] "Error : Exception: model2dee73e75235__namespace::write_array: Cor_2 is not positive definite. (in 'anon_model', line 346, column 2 to column 66)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
[17] "In addition: Warning messages:"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
[18] "1: In .local(object, ...) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
[19] "  some chains had errors; consider specifying chains = 1 to debug"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[20] "2: In validityMethod(object) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
[21] "  The following variables have undefined values:  b_Intercept,The following variables have undefined values:  cor_1[1],The following variables have undefined values:  cor_1[2],The following variables have undefined values:  cor_1[3],The following variables have undefined values:  cor_1[4],The following variables have undefined values:  cor_1[5],The following variables have undefined values:  cor_1[6],The following variables have undefined values:  cor_1[7],The following variables have undefined values:  cor_1[8],The following variables have undefined values:  cor_1[9],The following variables have undefined values:  cor_1[10],The following variables have undefined values:  cor_1[11],The following variables have undefined values:  cor_1[12],The following variables have undefined values:  cor_1[13],The following variables have undefined values:  cor_1[14],The following variables have undefined values:  cor_1[15],The following variables have undefined values:  cor_1[16],The following variabl [... truncated]"
[22] "3: There were 1 divergent transitions after warmup. See"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
[23] "https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[24] "to find out why this is a problem and how to eliminate them. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
[25] "4: Examine the pairs() plot to diagnose sampling problems"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[26] " "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[27] "5: In .local(object, ...) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
[28] "  some chains had errors; consider specifying chains = 1 to debug"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[29] "6: In validityMethod(object) :"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
[30] "  The following variables have undefined values:  b_Intercept,The following variables have undefined values:  cor_1[1],The following variables have undefined values:  cor_1[2],The following variables have undefined values:  cor_1[3],The following variables have undefined values:  cor_1[4],The following variables have undefined values:  cor_1[5],The following variables have undefined values:  cor_1[6],The following variables have undefined values:  cor_1[7],The following variables have undefined values:  cor_1[8],The following variables have undefined values:  cor_1[9],The following variables have undefined values:  cor_1[10],The following variables have undefined values:  cor_1[11],The following variables have undefined values:  cor_1[12],The following variables have undefined values:  cor_1[13],The following variables have undefined values:  cor_1[14],The following variables have undefined values:  cor_1[15],The following variables have undefined values:  cor_1[16],The following variabl [... truncated]"
[31] "7: There were 1 divergent transitions after warmup. See"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
[32] "https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[33] "to find out why this is a problem and how to eliminate them. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
[34] "8: Examine the pairs() plot to diagnose sampling problems"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[35] " "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
[36] "9: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
[37] "Running the chains for more iterations may help. See"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
[38] "https://mc-stan.org/misc/warnings.html#bulk-ess "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
error occurred during calling the sampler; sampling not done
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 5670.03 seconds (Warm-up)
Chain 4:                3237.61 seconds (Sampling)
Chain 4:                8907.64 seconds (Total)
Chain 4: 
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 5741.92 seconds (Warm-up)
Chain 2:                3195.77 seconds (Sampling)
Chain 2:                8937.69 seconds (Total)
Chain 2: 
here are whatever error messages were returned
[[1]]
Stan model 'anon_model' does not contain samples.

9068.608 sec elapsed
Compiling Stan program...
Start sampling
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
[1] "Error : Exception: model2dee45208a4e__namespace::write_array: Cor_2 is not positive definite. (in 'anon_model', line 346, column 2 to column 66)"
[2] "In addition: There were 11 warnings (use warnings() to see them)"                                                                                
error occurred during calling the sampler; sampling not done
here are whatever error messages were returned
[[1]]
Stan model 'anon_model' does not contain samples.

13440.145 sec elapsed
There were 15 warnings (use warnings() to see them)
> 
> 
> 
> 
> proc.time()
      user     system    elapsed 
249310.911   9889.337  46426.105 
